<?php
    $str_tbl = '';
    $toltal_salary = 0;
    $toltal_time = 0;
    foreach($summary as $k=>$v):
        $str_tbl .= '<tr>';
        
        $str_tbl .= "<td>".date('d/m/Y',$v['date'])."</td>";
        $str_tbl .= "<td>".$v['supplier']."</td>";
        $str_tbl .= "<td>".$v['codepurchase']."</td>";
        $str_tbl .= "<td>".$v['payment']."$</td>";
        $str_tbl .= "<td>".$v['payment']."$</td>";
        
        
        $toltal_salary += $v['payment'];
        
        $str_tbl .= '</tr>';
    endforeach;
/*
<td><strong>Code</strong></td>
                <td><strong>Staff</strong></td>
                <td><strong>Mobile</strong></td>
                <td><strong>Status</strong></td>
                <td><strong>Department</strong></td>
                <td><strong>Duration(h)</strong></td>
                <td><strong>Salary</strong></td>
*/    
?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Report Purchase</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style type="text/css" media="print">
.hide{display:none}
</style>
<script type="text/javascript">
function printpage() {
document.getElementById('printButton').style.visibility="hidden";
window.print();
document.getElementById('printButton').style.visibility="visible";  
}
</script>
<body>
<input name="print" type="button" value="Print" id="printButton" onClick="printpage()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center">
          <div align="right">
                      
              </div>
      <table width="595" border="0" cellspacing="0" cellpadding="0">
       
        <tr>
          <td height="30" align="center"><strong>Report Purchase</strong></td>
        </tr>
        <tr>
          <td height="30" align="center">&nbsp;</td>
        </tr>
        <tr>
          <td align="right"><table width="300" border="0" cellspacing="0" cellpadding="0">
            
            <tr>
              <td width="150"><strong>Total Purchase: </strong></td>
              <td width="150"><?=$toltal_salary?> $</td>
            </tr>
            <tr>
              <td width="150"><strong>Paid Amount: </strong></td>
              <td width="150"><?=$toltal_salary?> $</td>
            </tr>
            <!--<tr>
              <td width="150"><strong>Total department: <?=$countdepartment?> </strong></td>
              <td width="150">&nbsp;</td>
            </tr>-->
            
          </table></td>
        </tr>
        <tr>
          <td width="45"><hr></td>
        </tr>
        <tr>
          <td height="20"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="200"><strong>From: <?=$datestart?> </strong></td>
                <td width="393">&nbsp;</td>
                <td width="200"><strong>To: <?=$dateend?> </strong></td>
                <td width="">&nbsp;</td>
              </tr>
          </table></td>
        </tr>
        <tr>
          <td width="45"><hr></td>
        </tr>
        <tr>
          <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><strong>Date</strong></td>
                <td><strong>Supplier</strong></td>
                <td><strong>Purchase ID</strong></td>
                <td><strong>Paid</strong></td>
                <td><strong>Total</strong></td>
                
              </tr>
			  <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
              <?=$str_tbl?>
			  
          </table></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
        </tr>
    </table></td>
  </tr>
</table>

</body>
</html>
